<template>
  <div class="forgot-password-page">
    <div class="forgot-password-container">
      <!-- 标题 -->
      <h2>忘记密码</h2>
      <p>请输入您的邮箱地址，我们将发送密码重置链接到您的邮箱。</p>

      <!-- 忘记密码表单 -->
      <form @submit.prevent="handleForgotPassword">
        <div class="form-group">
          <label for="email">邮箱地址</label>
          <input
              type="email"
              id="email"
              v-model="forgotPasswordForm.email"
              placeholder="请输入您的邮箱"
              required
          />
        </div>
        <button type="submit">发送重置链接</button>
      </form>

      <!-- 返回登录链接 -->
      <div class="back-to-login">
        <p>想起密码了？<a href="/login">返回登录</a></p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ForgotPasswordPage',
  data() {
    return {
      // 忘记密码表单数据
      forgotPasswordForm: {
        email: '',
      },
    };
  },
  methods: {
    // 处理忘记密码
    handleForgotPassword() {
      const { email } = this.forgotPasswordForm;
      if (email) {
        console.log('发送重置链接到:', email);
        alert('密码重置链接已发送到您的邮箱，请查收！');
        // 这里可以调用忘记密码 API
      } else {
        alert('请输入邮箱地址！');
      }
    },
  },
};
</script>

<style scoped>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');

.forgot-password-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0e9aa7, #057885);
  font-family: 'Noto Sans SC', sans-serif;
  padding: 20px;
}

.forgot-password-container {
  background-color: white;
  border-radius: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 10px;
  color: #333;
}

p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

label {
  display: block;
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 5px;
}

input[type='email'] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease;
}

input[type='email']:focus {
  border-color: #0e9aa7;
}

button[type='submit'] {
  width: 100%;
  padding: 12px;
  background-color: #0e9aa7;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button[type='submit']:hover {
  background-color: #057885;
}

.back-to-login {
  margin-top: 20px;
  font-size: 0.9rem;
  color: #666;
}

.back-to-login a {
  color: #0e9aa7;
  text-decoration: none;
  transition: color 0.3s ease;
}

.back-to-login a:hover {
  color: #057885;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .forgot-password-container {
    padding: 20px;
  }

  h2 {
    font-size: 1.5rem;
  }

  p {
    font-size: 0.8rem;
  }
}
</style>